home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
726-750
/
744
/
fo2
/
sources_fo2
/
gadgets.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-18
|
5KB
|
197 lines
#include "defs.h"
Prototype BYTE HandleIDCMP2(struct Window *win);
Prototype OffGadgets(struct Window *win);
Prototype DisGadget(struct Gadget *gadget);
Prototype UnDisGadget(struct Gadget *gadget);
Prototype OnGadgets(struct Window *win);
Prototype UnSelGadget(struct Window *win,struct Gadget *gadget);
Prototype SelGadget(struct Window *win,struct Gadget *gadget);
Prototype SelGadgetnoRem(struct Gadget *gadget,BOOL flag);
extern struct Gadget Gadget1;
extern struct Gadget Gadget2;
extern struct Gadget Gadget3;
extern struct Gadget Gadget4;
extern struct Gadget Gadget5;
extern struct Gadget Gadget6;
extern struct Gadget Gadget7;
extern struct Gadget Gadget8;
extern struct Gadget Gadget9;
extern struct Gadget Gadget10;
extern struct Gadget Gadget11;
extern struct Gadget Gadget12;
extern struct Gadget Gadget13;
extern struct Gadget Gadget14;
extern struct Gadget Gadget15;
extern struct Gadget Gadget16;
extern struct Gadget Gadget17;
extern struct Gadget Gadget18;
BYTE HandleIDCMP2(win)
struct Window *win;
{
UBYTE flag = 0;
struct IntuiMessage *message = NULL;
USHORT code;
ULONG class;
struct Gadget *address;
/* Examine pending messages */
while( message = (struct IntuiMessage *)GetMsg(win->UserPort) ) {
class = message->Class;+
code = message->Code;
address = message->IAddress;
/* When we're through with a message, reply */
ReplyMsg( (struct Message *)message);
/* See what events occurred */
switch( class ) {
case CLOSEWINDOW:
return(1);
case GADGETDOWN:
switch ( address->GadgetID)
{
case 12 : return(2);
} break;
case DISKINSERTED :
return(3);
case DISKREMOVED :
return(4);
default : return(0);
}
}
return(0);
}
OffGadgets(win)
struct Window *win;
{
struct Gadget *gadg;
BYTE n;
RemoveGList(win,&Gadget1,18);
DisGadget(&Gadget1);
DisGadget(&Gadget2);
DisGadget(&Gadget3);
DisGadget(&Gadget4);
DisGadget(&Gadget5);
DisGadget(&Gadget6);
DisGadget(&Gadget7);
DisGadget(&Gadget8);
DisGadget(&Gadget9);
DisGadget(&Gadget10);
DisGadget(&Gadget11);
DisGadget(&Gadget12);
/* DisGadget(&Gadget13);*/
DisGadget(&Gadget14);
DisGadget(&Gadget15);
DisGadget(&Gadget16);
AddGList(win,&Gadget1,0,18,0);
RefreshGList(&Gadget1,win,0,18);
RefreshGList(&Gadget14,win,0,1);
RefreshGList(&Gadget16,win,0,1);
}
DisGadget(gadget)
struct Gadget *gadget;
{
gadget->Flags |= GADGDISABLED;
gadget->Flags &= ~SELECTED;
}
UnDisGadget(gadget)
struct Gadget *gadget;
{
gadget->Flags &= ~GADGDISABLED;
gadget->Flags &= ~SELECTED;
}
OnGadgets(win)
struct Window *win;
{
struct Gadget *gadg;
BYTE n;
RemoveGList(win,&Gadget1,16);
if (DF0) { UnDisGadget(&Gadget1); UnDisGadget(&Gadget5); }
if (DF1) { UnDisGadget(&Gadget2); UnDisGadget(&Gadget6); }
if (DF2) { UnDisGadget(&Gadget3); UnDisGadget(&Gadget7); }
if (DF3) { UnDisGadget(&Gadget4); UnDisGadget(&Gadget8); }
UnDisGadget(&Gadget9);
UnDisGadget(&Gadget10);
UnDisGadget(&Gadget11);
UnDisGadget(&Gadget12);
UnDisGadget(&Gadget14);
UnDisGadget(&Gadget15);
UnDisGadget(&Gadget16);
UnDisGadget(&Gadget17);
UnDisGadget(&Gadget18);
switch (sourceDrive)
{
case 0: SelGadgetnoRem(&Gadget1,1); break;
case 1: SelGadgetnoRem(&Gadget2,1); break;
case 2: SelGadgetnoRem(&Gadget3,1); break;
case 3: SelGadgetnoRem(&Gadget4,1); break;
}
switch (destDrive)
{
case 0: SelGadgetnoRem(&Gadget5,1); break;
case 1: SelGadgetnoRem(&Gadget6,1); break;
case 2: SelGadgetnoRem(&Gadget7,1); break;
case 3: SelGadgetnoRem(&Gadget8,1); break;
}
if (FLnog) SelGadgetnoRem(&Gadget12,1);
if (!FORMAT) SelGadgetnoRem(&Gadget11,1);
if (CHECK) SelGadgetnoRem(&Gadget15,1);
if (AUTO) SelGadgetnoRem(&Gadget14,1);
if (MULTI) SelGadgetnoRem(&Gadget16,1);
if (CLI) {SelGadgetnoRem(&Gadget10,1); SelGadgetnoRem(&Gadget9,0);}
else {SelGadgetnoRem(&Gadget10,0); SelGadgetnoRem(&Gadget9,1);}
AddGList(win,&Gadget1,0,16,0);
RefreshGList(&Gadget1,win,0,16);
RefreshGList(&Gadget12,win,0,1);
RefreshGList(&Gadget14,win,0,1);
RefreshGList(&Gadget16,win,0,1);
}
UnSelGadget(win,gadget)
struct Window *win;
struct Gadget *gadget;
{
if (gadget->Flags & SELECTED)
{
RemoveGList(win,gadget,1);
gadget->Flags &= ~SELECTED;
AddGList(win,gadget,gadget->GadgetID,1,0);
RefreshGList(gadget,win,0,1);
}
}
SelGadget(win,gadget)
struct Window *win;
struct Gadget *gadget;
{
if (!(gadget->Flags & SELECTED))
{
RemoveGList(win,gadget,1);
gadget->Flags |= SELECTED;
AddGList(win,gadget,gadget->GadgetID,1,0);
RefreshGList(gadget,win,0,1);
}
}
SelGadgetnoRem(gadget,flag)
struct Gadget *gadget;
BOOL flag;
{
if (flag) gadget->Flags |= SELECTED;
else gadget->Flags &= ~SELECTED;
}